package com.atguigu.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.entity.Dict;
import com.atguigu.result.Result;
import com.atguigu.service.DictService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author: 翟文海
 * @Date: 2022/10/28/028 15:39
 * @Version: 1.0
 * @Description: TODO
 **/
@Controller
@RequestMapping("/dict")
public class DictController {
    @Reference
    private DictService dictService;

    @ResponseBody
    @RequestMapping("/findZnodes")
    public Result findZnodes(@RequestParam(value = "id", defaultValue = "0") Long id) {
        List<Map<String, Object>> data = dictService.findZnodes(id);
        return Result.ok(data);
    }
    @GetMapping("/findDictListByParentId/{parentId}")
    @ResponseBody
    public Result findDictListByParentId(@PathVariable Long parentId) {
        List<Dict> dictList = dictService.findDictListByParentId(parentId);
        return Result.ok(dictList);
    }
}
